package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_department")
@ApiModel(value = "部门实体类")
public class Department extends BaseTreeNode<Department> {

    /**
     * 部门编号
     */
    @NotBlank(message = "请输入编号")
    @Size(min = 3,max = 6,message = "请输入3-6位数字")
    @ApiModelProperty(value = "部门编号")
    private String sn;
    /**
     * 部门名称
     */
    @NotBlank(message = "请输入名称")
    @ApiModelProperty(value = "部门名称")
    private String name;
    /**
     * 部门状态
     */
    @ApiModelProperty(value = "部门状态")
    private Integer state;
    /**
     * 部门管理员id
     */
    @ApiModelProperty(value = "部门管理员id")
    private Long managerId;

    /**
     * 部门级联路径
     */
    private String dirPath;
    /**
     *部门管理员
     */
    @Transient//不参与crud
    private Employee manager;
    /**
     * 上级部门
     */
    @ApiModelProperty(value = "上级部门")
    @Transient
    private Department parent;

    @Transient
    private long[] parentIds;

}
